\begin{algorithm}[H]
    \renewcommand{\algorithmicrequire}{\textbf{Input:}}
	\renewcommand{\algorithmicensure}{\textbf{Output:}}
	\caption{利用辨识矩阵做属性约简}
    \label{al:bsjz}
    \begin{algorithmic}[1] % 控制是否有序号
        \Require Data Table $(U,Attr)$ ; % input 的内容
	    \Ensure Attribute Reduction $B_k\subseteq A,k=1,2,\cdots,q$; % output 的内容
        
        \State $R_A = [\,\,\,]$
        \For {$i=1;i<|U|;i++$}
            \For {$j=1;j<|U|;j++$}
                \If {$F(U[i], Attr) == F(U[j], Attr)$ }
                    \State $R_A.append((i,j))$
                \EndIf 
            \EndFor 
        \EndFor 
        
        \State ${\rm partition} = \{\}$
        \For {$i=1;i<|U|;i++$}
            \State ${\rm partition}[i] = [\,\,\,]$
            \For {$j=1;j<|U|;j++$ }
                \If {$(i,j) \in R_A$}
                    \State ${\rm partition}[i].append(j)$
                \EndIf 
            \EndFor 
        \EndFor 
        
        \State $C = \text{unique\_value}(partition).key()$
        % \State get the subset $(C,Attr)$ of $(U,Attr)$
        \State $\mathscr{D} = matrix_{|C|\times |C|}$ 
        \For {$i=1;i<|C|;i++$ }
            \For {$j=1;j<|C|;j++$ }
                \State $\mathscr{D}_{i,j} = [\,\,\,]$
                \For {$attr\,\, in\,\, Attr$ }
                    \If {$f_{attr}(x_i) \ne f_{attr}(x_j)$}
                        \State $\mathscr{D}_{i,j}.append(attr)$
                    \EndIf 
                \EndFor 
            \EndFor 
        \EndFor 
        \State $minFormular = \varnothing$
        \For {$i\ne j \,\,in\,\, \mathscr{D}\text{'s raw and column}$ }
            \State $minFormular = minFormular \bigwedge \mathscr{D}_{i,j}$
        \EndFor
        \State $minFormularDnf = dnf(minFormular)$
        \State $B = minFormularDnf.args$


        \State \textbf{return} $\left\{ B_1,B_2,\cdots,B_q \right\}$.
    \end{algorithmic}
\end{algorithm}